import axios from 'axios'

const http = axios.create({
    baseURL: '/RestfulApi',
    timeout: 5000,
});

http.interceptors.request.use((config) => {
    if (config.method === 'get') {
        config.data = true
        config.headers['Content-Type'] = 'application/json'
    }
    return config
});

http.interceptors.response.use((res) => {
    return res.data;
}, (error) => {
    return Promise.reject(new Error('false'));
});

export default http;